package com.tamtamy.jttamobile.data;

/**
 * Handles the response to URI calls for  
 * <a href="https://tamtamy.reply.it/wiki/API#Contents_list">Content List</a> 
 *  
 * @see ArrayList 
 * @author Omar "0m4r" Adobati 
 * @version %I%, %G% 
 * 
 */
import java.util.ArrayList;
import java.util.Date;

public class Content extends ArrayList<String>{	

	private static final long serialVersionUID = -1001038203619933138L;
	
	//FILTER PARAMS
	static final public String CONTENT_FILTER_NONE = null;
	static final public String CONTENT_FILTER_LINK = "link";
	static final public String CONTENT_FILTER_DOCUMENT = "document";
	static final public String CONTENT_FILTER_VIDEO = "video";
	static final public String CONTENT_FILTER_AUDIO = "audio";
	static final public String CONTENT_FILTER_UWA = "uwa";
	static final public String CONTENT_FILTER_MESSAGE = "message";
	static final public String CONTENT_FILTER_QUESTION = "question";
	
	//SORTING PARAMS
	static final public String CONTENT_ORDER_NONE = null;
	static final public String CONTENT_ORDER_LAST = "last";
	static final public String CONTENT_ORDER_MOST_RATED = "most.rated";
	static final public String CONTENT_ORDER_MOST_VIEWED = "most.viwed";
	static final public String CONTENT_ORDER_MOST_FAVOURITED = "most.favourited";
	static final public String CONTENT_ORDER_HOTTEST = "hottest"; 
	
	//TYPE PARAMS
	static final public String CONTENT_TYPE_FILE = "1";
	static final public String CONTENT_TYPE_LINK = "2";
	static final public String CONTENT_TYPE_WIDGET = "3";
	static final public String CONTENT_TYPE_MESSAGE = "4";
	static final public String CONTENT_TYPE_QUESTION = "5";
	
	//TYPE PARAMS
	static final public String CONTENT_TYPE_FILE_LABEL = "file";
	static final public String CONTENT_TYPE_LINK_LABEL = "link";
	static final public String CONTENT_TYPE_WIDGET_LABEL = "widget";
	static final public String CONTENT_TYPE_MESSAGE_LABEL = "message";
	static final public String CONTENT_TYPE_QUESTION_LABEL = "question";
	static final public String CONTENT_TYPE_BLOG_LABEL = "blogpost";

	protected long id;
	protected String title;
	protected String url;
	protected String description;
	protected String permission;
	protected String discussionPermission;
	protected Date creationDate;
	protected Date updateDate;
	protected String userID;
	protected String favouriteCounter;
	protected String highlight;
	protected String numberOfComments;
	protected String rateEnabled;
	protected ArrayList<String> tagList;
	protected String rate;
	protected String ratesNumber;	
	protected String languageCode;
	protected ArrayList<String> commentsList;
	protected String views;
	protected String downloads;	
	protected String network;
	protected String descriptionPlainText;
	protected String permalink;

	protected String thumbnailOriginal;
	protected String contentType;
	protected String type;
	protected String contentTypeCategory;
	protected String thumbnailSmall;
	protected String thumbnailMedium;
	protected String thumbnailRect;
	protected boolean thumbnailPresent;

	protected String size;

	public Content() {
		this.id = 0;
		this.title = null;
		this.url = null;
		this.description = null;
		this.permission = null;
		this.discussionPermission = null;
		this.creationDate = null;
		this.updateDate = null;
		this.userID = null;
		this.favouriteCounter = null;
		this.highlight = null;
		this.numberOfComments = null;
		this.rateEnabled = null;
		this.tagList = new ArrayList<String>();
		this.rate = null;
		this.ratesNumber = null;
		this.languageCode = null;
		this.commentsList = new ArrayList<String>();
		this.views = null;
		this.downloads = null;
		this.network = null;

		this.thumbnailOriginal = null;
		this.contentType = null;
		this.type = null;
		this.contentTypeCategory = null;
		this.thumbnailSmall = null;
		this.thumbnailMedium = null;
		this.thumbnailRect = null;
		this.thumbnailPresent = false;
	}	

	public Content(long id, String title, String url, String description,
			String permission, String discussionPermission,
			Date creationDate, Date updateDate, String userID,
			String favouriteCounter, String highlight, String numberOfComments,
			String rateEnabled, ArrayList<String> tags, String rate,
			String ratesNumber, String languageCode,
			ArrayList<String> commentList, String views, String downloads,
			String network,String thumbnailOriginal,String contentType,String type,
			String contentTypeCategory,String thumbnailSmall,String thumbnailMedium,
			String thumbnailRect, boolean thumbnailPresent) {
		this.id = id;
		this.title = title;
		this.url = url;
		this.description = description;
		this.permission = permission;
		this.discussionPermission = discussionPermission;
		this.creationDate = creationDate;
		this.updateDate = updateDate;
		this.userID = userID;
		this.favouriteCounter = favouriteCounter;
		this.highlight = highlight;
		this.numberOfComments = numberOfComments;
		this.rateEnabled = rateEnabled;
		this.tagList = tags;
		this.rate = rate;
		this.ratesNumber = ratesNumber;
		this.languageCode = languageCode;
		this.commentsList = commentList;
		this.views = views;
		this.downloads = downloads;
		this.network = network;

		this.thumbnailOriginal = thumbnailOriginal;
		this.contentType = contentType;
		this.type = type;
		this.contentTypeCategory = contentTypeCategory;
		this.thumbnailSmall = thumbnailSmall;
		this.thumbnailMedium = thumbnailMedium;
		this.thumbnailRect = thumbnailRect;
		this.thumbnailPresent = thumbnailPresent;
	}	

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getPermission() {
		return permission;
	}

	public void setPermission(String permission) {
		this.permission = permission;
	}

	public String getDiscussionPermission() {
		return discussionPermission;
	}

	public void setDiscussionPermission(String discussionPermission) {
		this.discussionPermission = discussionPermission;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public String getUserID() {
		return userID;
	}

	public void setUserID(String userID) {
		this.userID = userID;
	}

	public String getFavouriteCounter() {
		return favouriteCounter;
	}

	public void setFavouriteCounter(String favouriteCounter) {
		this.favouriteCounter = favouriteCounter;
	}

	public String getHighlight() {
		return highlight;
	}

	public void setHighlight(String highlight) {
		this.highlight = highlight;
	}

	public String getNumberOfComments() {
		return numberOfComments;
	}

	public void setNumberOfComments(String numberOfComments) {
		this.numberOfComments = numberOfComments;
	}

	public String getRateEnabled() {
		return rateEnabled;
	}

	public void setRateEnabled(String rateEnabled) {
		this.rateEnabled = rateEnabled;
	}

	public ArrayList<String> getTags() {
		return tagList;
	}

	public void setTags(ArrayList<String> tags) {
		this.tagList = tags;
	}

	public String getRate() {
		return rate;
	}

	public void setRate(String rate) {
		this.rate = rate;
	}

	public String getRatesNumber() {
		return ratesNumber;
	}

	public void setRatesNumber(String ratesNumber) {
		this.ratesNumber = ratesNumber;
	}

	public String getLanguageCode() {
		return languageCode;
	}

	public void setLanguageCode(String languageCode) {
		this.languageCode = languageCode;
	}

	public ArrayList<String> getCommentList() {
		return commentsList;
	}

	public void setCommentList(ArrayList<String> commentList) {
		this.commentsList = commentList;
	}

	public String getViews() {
		return views;
	}

	public void setViews(String views) {
		this.views = views;
	}

	public String getDownloads() {
		return downloads;
	}

	public void setDownloads(String downloads) {
		this.downloads = downloads;
	}

	public String getNetwork() {
		return network;
	}

	public void setNetwork(String network) {
		this.network = network;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getDescriptionPlainText() {
		return descriptionPlainText;
	}

	public void setDescriptionPlainText(String descriptionPlainText) {
		this.descriptionPlainText = descriptionPlainText;
	}

	public String getPermalink() {
		return permalink;
	}

	public void setPermalink(String permalink) {
		this.permalink = permalink;
	}

	@Override
	public String toString() {
		return "Content [id=" + id + ", title=" + title + ", url=" + url
		+ ", description=" + description + ", permission=" + permission
		+ ", discussionPermission=" + discussionPermission
		+ ", creationDate=" + creationDate + ", updateDate="
		+ updateDate + ", userID=" + userID + ", favouriteCounter="
		+ favouriteCounter + ", highlight=" + highlight
		+ ", numberOfComments=" + numberOfComments + ", rateEnabled="
		+ rateEnabled + ", tags=" + tagList + ", rate=" + rate
		+ ", ratesNumber=" + ratesNumber + ", languageCode="
		+ languageCode + ", commentList=" + commentsList + ", views="
		+ views + ", downloads=" + downloads + ", network=" + network
		+ ", descriptionPlainText=" + descriptionPlainText
		+ ", permalink=" + permalink + ", modCount=" + modCount + "]";
	}


	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}


	public boolean isThumbnailPresent() {
		return thumbnailPresent;
	}

	public void setThumbnailPresent(boolean thumbnailPresent) {
		this.thumbnailPresent = thumbnailPresent;
	}

	public String getThumbnailSmall() {
		return thumbnailSmall;
	}

	public void setThumbnailSmall(String thumbnailSmall) {
		this.thumbnailSmall = thumbnailSmall;
	}

	public String getThumbnailRect() {
		return thumbnailRect;
	}

	public void setThumbnailRect(String thumbnailRect) {
		this.thumbnailRect = thumbnailRect;
	}

	public String getThumbnailMedium() {
		return thumbnailMedium;
	}

	public void setThumbnailMedium(String thumbnailMedium) {
		this.thumbnailMedium = thumbnailMedium;
	}

	public String getThumbnailOriginal() {
		return thumbnailOriginal;
	}

	public void setThumbnailOriginal(String thumbnailOriginal) {
		this.thumbnailOriginal = thumbnailOriginal;
	}

	public String getContentType() {
		return contentType;
	}

	public void setContentType(String contentType) {
		this.contentType = contentType;
	}

	public String getContentTypeCategory() {
		return contentTypeCategory;
	}

	public void setContentTypeCategory(String contentTypeCategory) {
		this.contentTypeCategory = contentTypeCategory;
	}
	
	public String getThumbnailUrl(){
		String imgUrl = null;
		if(imgUrl==null && null!=getThumbnailSmall())
			imgUrl = getThumbnailSmall();
		else if(imgUrl==null && null != getThumbnailMedium())
			imgUrl = getThumbnailMedium();
		else if(imgUrl==null && null != getThumbnailOriginal())
			imgUrl = getThumbnailOriginal();
		else if(imgUrl==null && null != getThumbnailRect())
			imgUrl = getThumbnailRect();
		return imgUrl;
	}
}
